import serial
import io
import sys



def open_COM1():
    ser = serial.Serial()
    ser.baudrate = 19200
    ser.port = 'COM1'
    ser.open()

    sio = io.TextIOWrapper(io.BufferedRWPair(ser, ser))
    sio.readline()
    print("test")


# open_COM1()
# stdin = io.TextIOWrapper(io.BufferedRWPair(sys.stdin, sys.stdout))
# s = sys.stdin.readline()
# print(s)

ser = serial.serial_for_url('loop://', timeout=1)
# sio = io.TextIOWrapper(io.BufferedRWPair(ser, ser))


sio = io.TextIOWrapper(io.BufferedReader(ser))

# sio.write("hello\n")
# sio.flush() # it is buffering. required to get the data out *now*
ser.write(b"hel\n")
# hello = sio.readline()
hello = ser.read(10)
print(hello)